package com.backweb.Confige;

import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Objects;

@Component
public class MyInterceptor implements HandlerInterceptor {

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws IOException {
        /* Object user = request.getSession().getAttribute("user");
         if(!Objects.isNull(user)){
               return true;
         }
         else
         {
             response.sendRedirect("/");
             return false;
         }*/
        return true;
    }
}